
///////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2021, Tom Zhao personal. ("UsingSTLEx")
// This software is a personal tools project by Tom Zhao.
// Description:
///////////////////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include <string>

using std::cout;
using std::endl;
using std::string;

// string赋值操作的使用
void TzStringOperatorCase01() {
  string str1;
  str1 = "hello world";
  cout << "str1 = " << str1 << endl;
  string str2;
  str2 = str1;
  cout << "str2 = " << str2 << endl;
  string str3;
  str3 = 'a';
  cout << "str3 = " << str3 << endl;
  string str4;
  str4.assign("hello c++");
  cout << "str4 = " << str4 << endl;
  string str5;
  str5.assign("hello c++", 5);
  cout << "str5 = " << str5 << endl;
  string str6;
  str6.assign(str5);
  cout << "str6 = " << str6 << endl;
  string str7;
  str7.assign(5, 'x');
  cout << "str7 = " << str7 << endl;
}

int main(int argc, char* argv[]) {
  TzStringOperatorCase01();
  system("pause");
  return 0;
}
